package com.hk.controller;

import com.hk.compoent.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yellow Docter
 * @date 2023 -10-09
 * @desc
 *    1、可以通过@Value的方式获取配置文件中的数据
 *    2、通过Environment 对象 environment.getProperty("配置文件中的key", String.class);
 */
@RestController
public class Demo02Controller {
    @Autowired
    private Student stu;

    @RequestMapping("/read3")
    public Student read3(){
        System.out.println(stu);
        return stu;
    }
}
